package com.mall.common.attributes;

public class EnumType {

	/**
	 * 数据来源类型：1:SDK；2:HTML；3:PC；4:OTHER；
	 * 
	 * @author tgy
	 *
	 */
	public enum DATA_TYPE_STATUS {
		SDK(1, "SDK"), HTML(2, "HTML"), PC(3, "PC"), OTHER(4,"OTHER");

		private int index;

		private String name;

		private DATA_TYPE_STATUS(int index, String name) {

			this.index = index;
			this.name = name;
		}

		//通过name得到index(1,2,3,4)
		public static int getType(String name) {
			if(name.equals("SDK")){
				return DATA_TYPE_STATUS.SDK.index;
			}
			if(name.equals("HTML")){
				return DATA_TYPE_STATUS.HTML.index;
			}
			if(name.equals("PC")){
				return DATA_TYPE_STATUS.PC.index;
			}
			return DATA_TYPE_STATUS.OTHER.index;
		}
		//通过index得到(SDK,HTML,PC,OTHER)
		public static String getName(int index) {
			switch (index) {
			case 1:
				return DATA_TYPE_STATUS.SDK.name;
			case 2:
				return DATA_TYPE_STATUS.HTML.name;
			case 3:
				return DATA_TYPE_STATUS.PC.name;
			default:
				return DATA_TYPE_STATUS.OTHER.name;
			}
		}
		public int getIndex() {

			return index;
		}

		public void setIndex(int index) {

			this.index = index;
		}

		public String getName() {

			return name;
		}

		public void setName(String name) {

			this.name = name;
		}
	}
}
